import React, { Component } from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    View,
    TextInput,
    Image,
    TouchableOpacity, Dimensions, NativeModules,
} from 'react-native';
import { Actions } from 'react-native-router-flux';
import { pTd } from "../../util/adapter";
import Button from "../../component/Button"
import CallActionsOnce from "../../util/callActionsOnce"


export default class LoginIndex extends Component{

    constructor(props) {
        super(props);
        this.state = {

        };

    }


    handlePressGoLogin=()=>{
      //跳转登录
        CallActionsOnce(()=>Actions.Login())
    };

    handlePressGoInApplication=()=>{
        //跳转入驻申请
        CallActionsOnce(()=>Actions.ApplicationIn())
    }

    render() {

        return <View style={style.container}>
            <View style={style.logoWarp}>
                <Image
                    style={style.logo}
                    source={require('../../../assets/img/logo.png')}
                />
            </View>
            <View style={style.buttonWarp}>
                <Button
                    text="登录"
                    handlePressFunction={()=>this.handlePressGoLogin()}
                />
            </View>
            <Text style={style.loginTip}></Text>
            <View style={style.inButtonWarp}>
                <Button
                    text="入驻申请"
                    ButtonStyles={{backgroundColor: '#FE9727',borderColor:"#FE9727"}}
                    ButtonTextStyles={{fontSize: pTd(32),color: "#ffffff"}}
                    handlePressFunction={this.handlePressGoInApplication}
                />
            </View>
        </View>
    }
}


const style = StyleSheet.create({
    container:{
        flex:1,
        backgroundColor:"#ffffff",
    },
    logoWarp:{
        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center',
        marginTop: pTd(240)
    },
    logo:{
        width:pTd(220),
        height:pTd(200),
    },
    buttonWarp:{
        marginTop: pTd(140),
        height: pTd(96),
        display: 'flex',
        justifyContent: 'center',
        marginHorizontal:pTd(100),
        alignItems: 'center',
    },
    loginTip:{
        color:'#333333',
        fontSize:pTd(28),
        textAlign:'center',
        marginTop:pTd(140),
        marginBottom: pTd(40)
    },
    inButtonWarp:{
        height: pTd(96),
        display: 'flex',
        justifyContent: 'center',
        marginHorizontal:pTd(100),
        alignItems: 'center',
    }
});
